package com.ddx.common.util;


import com.ddx.common.enums.ErrorCode;

/**
 * @author zhangsl
 * @ClassName TaskResult
 * @Description 线程结果类
 * @date 2016/8/29 11:45
 */
public final class TaskResult {
    private int taskId;//线程ID
    private String type;//执行结果
    private String code;//错误码
    private String message;//错误信息

    private TaskResult() {
        super();
    }

    public static TaskResult getSuccessInstance(int taskId) {
        TaskResult taskResult = new TaskResult();
        taskResult.setTaskId(taskId);
        taskResult.setType(ErrorCode.RETURN_SUCCESS_0000.getType());
        taskResult.setCode(ErrorCode.RETURN_SUCCESS_0000.getCode());
        taskResult.setMessage(ErrorCode.RETURN_SUCCESS_0000.getMessage());
        return taskResult;
    }

    public int getTaskId() {
        return taskId;
    }

    public void setTaskId(int taskId) {
        this.taskId = taskId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return "TaskResult{" +
                "taskId='" + taskId + '\'' +
                ", type='" + type + '\'' +
                ", code='" + code + '\'' +
                ", message='" + message + '\'' +
                '}';
    }

    public String toPrint() {
        return "[" +
                "线程ID='" + taskId + '\'' +
                ", 结果类型='" + type + '\'' +
                ", 结果编码='" + code + '\'' +
                ", 结果详情='" + message + '\'' +
                ']';
    }
}
